//
//  ViewController.m
//  HZCCoding
//
//  Created by 胡忠诚 on 16/1/5.
//  Copyright © 2016年 biyu6. All rights reserved.
//

#import "ViewController.h"
#import "Man.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
#warning -演示结果
        Man *per = [[Man alloc] init];
        per.age = 20;
        per.height = 1.65;
        per.name = @"xiangfei";
        per.weight = 45.0;
        per.money = 1.0;
#warning -注意路径
        [NSKeyedArchiver archiveRootObject:per toFile:@"/Users/huzhongcheng/Desktop/per.data"];//归档
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
#warning -注意路径与归档的路径相同
        Man *per = [NSKeyedUnarchiver unarchiveObjectWithFile:@"/Users/huzhongcheng/Desktop/per.data"];//解档
        NSLog(@"%d %@ %f %.2f %.2f",per.age, per.name, per.height, per.weight, per.money);
}

@end
